package com.kh.pajx.sop.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kh.pajx.sop.base.BaseServiceImpl;
import com.kh.pajx.sop.dao.IHsExpressDao;
import com.kh.pajx.sop.domain.HsExpressRecord;
import com.kh.pajx.sop.service.IHsExpressService;
import com.kh.pajx.sop.util.page.QueryHelper;
/**
 * 快递信息 实现类
 * @author 
 * @return
 * @createDate 2015年4月7日 下午1:43:01
 */
@Service
@Transactional
public class HsExpressServiceImpl extends BaseServiceImpl<HsExpressRecord> implements IHsExpressService{
	@Resource
	private IHsExpressDao hsExpressDao;
	
	@Override
	public void findList(HsExpressRecord model, int pageNum, int numPerPage) {
		
		QueryHelper helper = new QueryHelper(HsExpressRecord.class,"nt");
		//快递编号
		helper.addCondition(StringUtils.isNotEmpty(model.getExpressCode()), "expressCode like ?","%"+StringUtils.trim(model.getExpressCode())+"%");
		
		//helper.addOrderProperty("createTime", false);
		helper.preparePageBean(hsExpressDao, pageNum, numPerPage);
	}
	
	@Override
	public void save(HsExpressRecord demo) {
		
		hsExpressDao.save(demo);
	}
	
	@Override
	public HsExpressRecord getById(String uuid) {
		
		return hsExpressDao.getById(uuid);
	}
	
	@Override
	public void update(HsExpressRecord demo) {
		
		hsExpressDao.update(demo);
	}

	@Override
	public List<HsExpressRecord> getByCode(String code) {
		String hql = " FROM HsExpressRecord d WHERE d.expressCode='"+code+"'";
		return hsExpressDao.findList(hql);
	}

}
